home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Meeting Pearls 4
/
Meeting Pearls Vol. IV (1996)(GTI - Schatztruhe)[!].iso
/
Pearls
/
dev
/
Oberon
/
OberonV4
/
system
/
Host.Mod
(
.txt
)
< prev
next >
Wrap
Oberon Text
|
1996-05-07
|
4KB
|
81 lines
Syntax10.Scn.Fnt
Syntax10i.Scn.Fnt
StampElems
Alloc
3 May 96
Syntax10m.Scn.Fnt
Syntax12i.Scn.Fnt
LineElems
Alloc
MODULE Host; (** SHML 19 Mar 96,
This module encapsulates all system_dependent variables and procedures of an Oberon System V4.
This is the version for Oberon for Amiga.
Created by Stefan H._M. Ludwig, Institute for Computer Systems, ETH Zurich, ludwig@inf.ethz.ch, 19 Mar 96
IMPORT Input, Display, Modules, Bitmaps;
Host-: ARRAY 32 OF CHAR; (** string identifying the host machine *)
TimeUnit-: LONGINT; (** resolution of Input.Time(), TimeUnit ticks happen per second *)
OptionChar-: CHAR; (** character used by command interpreters for specifying options *)
PathChar-: CHAR; (** character used in file names for separating subdirectories *)
backup: Bitmaps.Bitmap;
(* Support *)
PROCEDURE Append(VAR to(*inout*): ARRAY OF CHAR; this: ARRAY OF CHAR);
(* append this to to, trim this to space left in to *)
VAR toLen, i, j: LONGINT;
BEGIN
i := -1;
REPEAT INC(i) UNTIL to[i] = 0X;
toLen := LEN(to)-1; j := 0;
WHILE (i # toLen) & (this[j] # 0X) DO to[i] := this[j]; INC(i); INC(j) END;
to[i] := 0X
END Append;
(* Exported procedures *)
PROCEDURE Backup*(X, Y, W, H: INTEGER);
(** Backup screen area X, Y, W, H; (must not be followed by Backup) *)
BEGIN
backup := Bitmaps.New(W, H);
Bitmaps.CopyBlock(Bitmaps.Disp, backup, X, Y, W, H, 0, 0, Display.replace)
END Backup;
PROCEDURE Restore*(X, Y, W, H: INTEGER);
(** Restore screen area X, Y, W, H; (must be preceded by Backup) *)
BEGIN
IF backup # NIL THEN Bitmaps.CopyBlock(backup, Bitmaps.Disp, 0, 0, W, H, X, Y, Display.replace) END
END Restore;
PROCEDURE IsFileNameChar*(ch: CHAR): BOOLEAN; (** Is ch part of a valid file name? *)
BEGIN
CASE ch OF
| "A".."Z", "a".."z", "0".."9", ".", "/", "_", ":": RETURN TRUE
ELSE RETURN FALSE
END
END IsFileNameChar;
PROCEDURE CallError*(command: ARRAY OF CHAR; res: INTEGER; VAR msg(*out*): ARRAY OF CHAR);
(** Translate error message when the call of command fails; (res # 0, 100); (LEN(msg) >= 32, 101) *)
VAR i, j: INTEGER;
BEGIN
ASSERT(res # 0, 100); ASSERT(LEN(msg) >= 32, 101);
IF res > 0 THEN
COPY("Call error: ", msg); Append(msg, Modules.importing);
IF res = 1 THEN Append(msg, " not found")
ELSIF res = 2 THEN Append(msg, " not an obj-file")
ELSIF res = 3 THEN
Append(msg, " imports ");
Append(msg, Modules.imported); Append(msg, " with bad key")
ELSIF res = 4 THEN Append(msg, " corrupted obj file")
ELSIF res = 5 THEN Append(msg, command); Append(msg, " command not found")
ELSIF res = 6 THEN Append(msg, " has too many imports")
ELSIF res = 7 THEN Append(msg, " not enough space")
END
ELSIF res < 0 THEN
i := -1;
REPEAT INC(i) UNTIL (command[i] = ".") OR (command[i] = 0X);
IF command[i] = 0X THEN i := -1 END;
j := -1;
REPEAT INC(i); INC(j); msg[j] := command[i] UNTIL command[i] = 0X; (* copy procedure name *)
Append(msg, " not found")
END
END CallError;
BEGIN
Host := "Amiga";
OptionChar := "\"; PathChar := "/";
TimeUnit := Input.TimeUnit
END Host.